package com.cx.webpay.util;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 文件公共常量
 */
@Component
@ConfigurationProperties
public class FileCommonConstant {
	
	@Value("${file.ftp.enabled}")
	private boolean ftpEnable;
	@Value("${file.wkhtmltopdf}")
	private String wkhtmltopdfpath;
	@Value("${file.storage}")
	private String fileStorage;
	@Value("${file.gateway-enable}")
	private Boolean gatewayEnable;
	@Value("${file.service-ddress}")
	private String serviceIpAddr;
	
	/**服务名称*/
	public static String SERVICE_NAME;
	/**服务端口*/
	public static int SERVICE_PORT;
	/**ftp是否开启*/
	public static boolean FTP_ENABLE;
	/**wkhtmltopdf命令**/
	public static  String WKHTMLTOPDFPATH;
	/**保存文件路径 */
	public static String FILE_SAVE_FILE_DEFAULT="/data/file";
	/**服务ip地址 */
	public static String SERVICE_IP_ADDR = "";
	/**用户登录cookie名字常量*/
	public static final String USER_COOKIE_NAME="";
	/**参数传递固定常量 params*/
	public static final String PARAM_CONTANT="params";
	/**文件解压缩临时文件*/
	public static final String FILE_TEMP_COMPRESS_PATH="/data/temp_file/";
	/**文档处理默认加密钥匙*/
	public static final String DOCUMENT_ENCRYPT_KEY="qskjjt";
	/**默认水印图片**/
	public static final String DEFAULT_WATER_IMAGE="defautl.jpg";
	/**备份文件**/
	public static final String FILE_BACK_FILE_DEDAULT = "/data/back/";
	/**项目分组**/
	public static final String PROJECTTEAM = "projectTeam";
	/**默认图片小与 20kb**/
	public static final long DUFAULT_FILE_SIZE = 20*1024; 
	
	public static boolean GATEWAY_ENABLE=true;
	
	@PostConstruct
	public synchronized void  beforeInit() {
		FTP_ENABLE = ftpEnable;
		WKHTMLTOPDFPATH = wkhtmltopdfpath;
		FILE_SAVE_FILE_DEFAULT = fileStorage;
		GATEWAY_ENABLE = gatewayEnable;
		SERVICE_IP_ADDR = serviceIpAddr;
	}

}
